package com.example.laundry.dto;

import com.example.laundry.entity.OrderStatusHistoryEntity;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class OrderStatusHistoryDto {
    private Long id;
    private Long orderId;
    private String fromStatus;
    private String toStatus;
    private Long changedByUserId;
    private String changedByUsername;
    private String notes;
    private LocalDateTime createdAt;

    public static OrderStatusHistoryDto fromEntity(OrderStatusHistoryEntity entity) {
        OrderStatusHistoryDto dto = new OrderStatusHistoryDto();
        dto.setId(entity.getId());
        dto.setOrderId(entity.getOrder().getId());
        dto.setFromStatus(entity.getFromStatus());
        dto.setToStatus(entity.getToStatus());
        dto.setChangedByUserId(entity.getChangedBy().getId());
        dto.setChangedByUsername(entity.getChangedBy().getUsername());
        dto.setNotes(entity.getNotes());
        dto.setCreatedAt(entity.getCreatedAt());
        return dto;
    }
}